package com.longxi.tianjintianbao.greedao.entity;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.DaoException;
import com.longxi.tianjintianbao.greedao.dao.DaoSession;
import com.longxi.tianjintianbao.greedao.dao.PatrolDao;
import org.greenrobot.greendao.annotation.NotNull;
import com.longxi.tianjintianbao.greedao.dao.PatrolContentDao;

@Entity
public class PatrolContent {
    @Id(autoincrement = true)
    public Long id;
    public Long billid;//关联巡检单id
    public Long iptype;//登录用户所使用的ip类型
    private String item;//巡检项目
    private String itemcontent;//项目内容
    @ToOne(joinProperty = "billid")
    private Patrol patrol;//关系表
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 140186878)
    private transient PatrolContentDao myDao;

    @Generated(hash = 872173989)
    public PatrolContent(Long id, Long billid, Long iptype, String item,
            String itemcontent) {
        this.id = id;
        this.billid = billid;
        this.iptype = iptype;
        this.item = item;
        this.itemcontent = itemcontent;
    }

    @Generated(hash = 1821211469)
    public PatrolContent() {
    }

    @Generated(hash = 1959752598)
    private transient Long patrol__resolvedKey;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getBillid() {
        return billid;
    }

    public void setBillid(Long billid) {
        this.billid = billid;
    }

    public Long getIptype() {
        return iptype;
    }

    public void setIptype(Long iptype) {
        this.iptype = iptype;
    }

    public String getItem() {
        return item;
    }

    public void setItem(String item) {
        this.item = item;
    }

    public String getItemcontent() {
        return itemcontent;
    }

    public void setItemcontent(String itemcontent) {
        this.itemcontent = itemcontent;
    }

    /** To-one relationship, resolved on first access. */
    @Generated(hash = 294936070)
    public Patrol getPatrol() {
        Long __key = this.billid;
        if (patrol__resolvedKey == null || !patrol__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            PatrolDao targetDao = daoSession.getPatrolDao();
            Patrol patrolNew = targetDao.load(__key);
            synchronized (this) {
                patrol = patrolNew;
                patrol__resolvedKey = __key;
            }
        }
        return patrol;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 979392314)
    public void setPatrol(Patrol patrol) {
        synchronized (this) {
            this.patrol = patrol;
            billid = patrol == null ? null : patrol.getId();
            patrol__resolvedKey = billid;
        }
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 903525447)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getPatrolContentDao() : null;
    }

}
